using System;
using System.Windows.Forms;
using Sharpmark.PerfectLife.CommonFramework.Picture;
using Sharpmark.PerfectLife.CommonFramework.Picture.Utilities.ImageToText;
using Sharpmark.PerfectLife.ColorfulPhotos.TextualPhoto.SubFunctionForm;

namespace Sharpmark.PerfectLife.ColorfulPhotos.TextualPhoto
{
	public partial class FrmMain : Form
	{
		private FrmPhotoText frmTextPhoto = new FrmPhotoText();
		private FrmStringText frmTextString = new FrmStringText();
		private FrmPhotoHtmlText frmHtmltextPhoto = new FrmPhotoHtmlText();
		private FrmAbout frmAbout = new FrmAbout();

		public FrmMain ()
		{
			InitializeComponent();
		}

		private void FrmMain_Load (object sender, EventArgs e)
		{
			// 关于
			this.Text = this.ProductName + " Ver" + this.ProductVersion;
			//TODO: 处理异常

			frmTextPhoto.plMain.Parent = this.tbpTextPhoto;
			frmHtmltextPhoto.plMain.Parent = this.tbpHtmlTextPhoto;
			frmTextString.plMain.Parent = this.tbpTextString;
			frmAbout.plMain.Parent = this.tbpAbout;

			this.AcceptButton = frmTextPhoto.btnGenerate;
		}

		private void tcMain_SelectedIndexChanged (object sender, EventArgs e)
		{
			// 垃圾编码，却不知道怎么改。
			if (tcMain.SelectedTab.Name == tbpTextPhoto.Name)
				this.AcceptButton = frmTextPhoto.btnGenerate;

			if (tcMain.SelectedTab.Name == tbpTextString.Name)
				this.AcceptButton = frmTextString.btnGenerate;

			if (tcMain.SelectedTab.Name == tbpHtmlTextPhoto.Name)
				this.AcceptButton = frmHtmltextPhoto.btnGenerate;
		}
	}
}